<?php


#--------------------------------------------------
# ALL INCLUDES + STANDARD-VALUES
#--------------------------------------------------
include_once ("include/config.inc");
include_once ("include/template.inc");
include_once ("include/class.db.php5");
include_once ("include/class.tools.php5");
include_once ("include/class.time.php5");
$svo = new db("svoptik");
$tools = new tool();
$time = new TimeUtil();

include_once ("include/global_fix_extern.inc");

#--------------------------------------------------
# CREATE TEMPLATE
#--------------------------------------------------
$t = new Template("templates", "keep");
$t->set_file(array (
	"page" => "svoptik.tpl",
	"ticker" => "ticker.tpl",
	"navi" => "navi.tpl",
	"news" => "show_report.tpl"
));
#--------------------------------------------------
$t->set_var(array (
	"FORWARD" => ""
));

#--------------------------------------------------
# CREATE NAVIGATION RIGHT
#--------------------------------------------------
$links = "";
$url[0] = array (
	"URL" => "",
	"URL-TEXT" => ""
);
$url[1] = array (
	"URL" => "",
	"URL-TEXT" => ""
);
$url[2] = array (
	"URL" => "",
	"URL-TEXT" => ""
);
for ($i = 0; $i < count($url); $i++) {
	$links .= "
			        <tr>
						<td valign=\"top\"><img src=\"standard/spacer.gif\" width=\"20\" height=\"15\" border=\"0\" alt=\"\"></td>
						<td valign=\"top\"><a href=\"" . $url[$i]['URL'] . "\" class=\"sitenav\">" . $url[$i]['URL-TEXT'] . "</a></td>
						<td valign=\"top\"><img src=\"standard/spacer.gif\" width=\"20\" height=\"15\" border=\"0\" alt=\"\"></td>
					</tr>
			       ";
}
$t->set_var(array (
	"LINKS" => $links,
	"BANNER" => $banner
));
$right_nav = $t->parse("", "navi", true);
#--------------------------------------------------

#--------------------------------------------------
# CREATE ALL-TIME SAME THINGS
#--------------------------------------------------
include_once ("include/sameThings.php5");

#--------------------------------------------------

#--------------------------------------------------
# CREATE CONTENT "SINGLE REPORT"
#--------------------------------------------------
$content = "";
$tupel = $svo->readRecordset("select * from " . $table['Berichte'] . " WHERE report_id='" . $id . "';");
$auth = $svo->readRecordset("select * from " . $table['User'] . " where usr_id='" . $tupel['author_id'] . "';");

$image = "";
// bild setzen
$imgDir = "images/reports/" . $tupel['author_id'] . "/";
if (strlen($tupel['img']) > 0) {
	$image = sprintf("<center><a href=\"%s\" target\"_blank\"><img src=\"%s\" class=\"reportImg\" alt=\"%s\" title=\"%s\" width=\"400px\" border=\"0\"/></a></center>", $imgDir .
	$tools->html_replace($tupel['img']), $imgDir .
	$tools->html_replace($tupel['img']), $tools->html_replace($tupel['img_subtitle']), $tools->html_replace($tupel['img_subtitle']));
	$text = $image." ".$tupel['text'];
} else {
	$text = $tupel['text'];
	
}

$author = "<a href=\"mailto:" . $auth['usr_email'] . "\" class=\"news\">" . $auth['usr_vname'] . " " . $auth['usr_name'] . "</a>";
$link = "<a href=\"index.php5\" class=\"news\">zur&uuml;ck</a>";
$t->set_var(array (
	"LINK" => $link,
	"HEADLINE" => $tupel['headline'],
	"DATUM" => $time->out($tupel['date'],
	'd'
), "TEXT" => $text, "AUTHOR" => $author));
$content .= $t->parse("", "news", true);

#--------------------------------------------------

#--------------------------------------------------
# PARSE & OUTPUT
#--------------------------------------------------
$t->set_var(array (
	"sitenav" => "<a href=\"index.php5\" class=\"sitenav\">NEWS</a> -> EINZELANSICHT",
	"ticker" => $ticker,
	"content" => $content . "<br>",
	"navi" => $right_nav,
	"SYNCHRONIZE" => " "
));
$t->parse("ALL", "page", true);
$t->p("ALL");
?>
